import {getCookie} from '@/common/js/utils'
import {TOKEN_KEY} from '@/common/js/config'
const user = {
  state: {
    token: getCookie(TOKEN_KEY),
    menuList: [],
    permissions: [],
    userInfo: {}
  },
  mutations: {
    menuList: (state, menuList) => {
      state.menuList = menuList
    },
    permissions: (state, permissions) => {
      state.permissions = permissions
    },
    updateToken: (state, token) => {
      state.token = token
    },
    updateUserInfo: (state, userinfo) => {
      state.userInfo = userinfo
    }
  }
}
export default user
